/*
Copyright (c) 2025 Huawei Technologies Co., Ltd.
This file is a part of the CANN Open Software.
Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
Please refer to the License for details. You may not use this file except in compliance with the License.
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
See LICENSE in the root of the software repository for the full text of the License. 
*/

#include "../kernel_host.h"
#include "./LLMsGEMM_batch_QKTVP_device.cpp"

/**
 * @brief: host侧
 * @param [in] layoutA: A矩阵排布格式
 * @param [in] layoutB: B矩阵排布格式
 * @param [in] zeroPaddingM: A、C矩阵零填充后的M维度
 * @param [in] zeroPaddingN: B、C矩阵零填充后的N维度
 * @param [in] zeroPaddingK: A、B矩阵零填充后的K维度
 * @param [in] batchCount: 批量矩阵乘的batch数
 * @param [in] d_maskA: 掩码矩阵
 * @param [in] alpha: alpha*AB+beta*C
 * @param [in] d_A: 连续存储的零填充A矩阵首地址数组
 * @param [in] d_B: 连续存储的零填充B矩阵首地址数组
 * @param [in] beta:  alpha*AB+beta*C
 * @param [out] d_C: 每批矩阵乘的零填充B矩阵首地址数组
 * @param [in] stream: ACL同步流
 */
 void LLMsGEMM_batch_QKTVP_host (
    layoutType layoutA, 
    layoutType layoutB, 
    uint32_t zeroPaddingM, 
    uint32_t zeroPaddingN, 
    uint32_t zeroPaddingK, 
    uint32_t batchCount, 
    half *d_maskA, 
    half alpha,  
    half *d_A,  
    half *d_B, 
    half beta, 
    half *d_C,
    aclrtStream &stream, 
    uint8_t mode
) {
    kernel_host(
        LLMsGEMM_batch_QKTVP_device, 
        layoutA, 
        layoutB, 
        zeroPaddingM, 
        zeroPaddingN, 
        zeroPaddingK, 
        batchCount, 
        d_maskA, 
        alpha, 
        d_A, 
        d_B, 
        beta, 
        d_C, 
        stream, 
        mode
    );
}